package com.tiza.xiaoyoubao.ui.fragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;

import com.tianze.library.base.BaseFragment;
import com.tiza.xiaoyoubao.R;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by mapple on 17/2/17.
 */

public class ComplainCenterFragment extends BaseFragment {

    @BindView(R.id.view_start_complain)
    View view_start_complain;
    @BindView(R.id.view_receive_complain)
    View view_receive_complain;
    private static FragmentManager fm;
    @Override
    protected int getLayoutId() {
        return R.layout.fragment_complain_center;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        setToolbarTitle("申诉中心");
        fm=getFragmentManager();
        showFragment(new SendComplainFragment());
    }

    @OnClick({R.id.view_start_complain, R.id.view_receive_complain})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.view_start_complain:
                view_start_complain.setBackgroundResource(R.color.dodger_blue);
                view_receive_complain.setBackgroundResource(R.color.steel_blue);
                showFragment(new SendComplainFragment());
                break;
            case R.id.view_receive_complain:
                view_receive_complain.setBackgroundResource(R.color.dodger_blue);
                view_start_complain.setBackgroundResource(R.color.steel_blue);
                showFragment(new ReceivedComplainFragment());
                break;
        }

    }
    public static void showFragment(Fragment fragment) {
        FragmentTransaction transaction = fm.beginTransaction();
        transaction.replace(R.id.fl_content, fragment);
        transaction.commit();

    }
}
